package com.naiterui.ehp.bs.b2c.inventory.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "e_inventory")
public class Inventory implements Serializable {
    private static final long serialVersionUID = -1523708666583308824L;

    /**
     * 是否冻结  正常
     */
    public static final int STATUS_NORMAL = 0;

    /**
     * 是否冻结  冻结
     */
    public static final int STATUS_FREEZE = 1;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;

    @Column(name = "warehouse_id", nullable = false)
    private Long warehouseId;

    @Column(name = "product_id", nullable = false)
    private Long productId;

    @Column(name = "sku_id", nullable = false)
    private Long skuId;

    /**
     * 实物库存
     */
    @Column(name = "physical_quantity", nullable = false)
    private Long physicalQuantity;

    /**
     * 欲占库存数量
     */
    @Column(name = "will_quantity", nullable = false)
    private Long willQuantity;

    /**
     * 占用库存
     */
    @Column(name = "take_up_quantity", nullable = false)
    private Long takeUpQuantity;

    /**
     * 是否冻结  0:正常。1:冻结
     */
    @Column(name = "status", nullable = false)
    private Integer status;

    @Column(name = "created_at", nullable = false)
    private Date createdAt;

    @Column(name = "changed_at", nullable = false)
    private Date changedAt;

    @Column(name = "changed_by", nullable = false, length = 40)
    private String changedBy;

    @Column(name = "created_by", nullable = false, length = 40)
    private String createdBy;

    @Version
    @Column(name = "version", nullable = false)
    private Integer version;

}
